package com.dynamixsoftware.printershare.smb;

import com.dynamixsoftware.printershare.smb.util.Dumper;
import java.io.IOException;

class SmbException
  extends IOException
  implements DosError, NtStatus, WinError
{
  private int status;
  
  SmbException() {}
  
  SmbException(int paramInt, Throwable paramThrowable)
  {
    super(getMessageByCode(paramInt));
    if (paramThrowable != null) {
      initCause(paramThrowable);
    }
    this.status = getStatusByCode(paramInt);
  }
  
  SmbException(int paramInt, boolean paramBoolean) {}
  
  SmbException(String paramString)
  {
    super(paramString);
    this.status = -1073741823;
  }
  
  SmbException(String paramString, Throwable paramThrowable)
  {
    super(paramString);
    if (paramThrowable != null) {
      initCause(paramThrowable);
    }
    this.status = -1073741823;
  }
  
  static String getMessageByCode(int paramInt)
  {
    if (paramInt == 0) {
      return "NT_STATUS_SUCCESS";
    }
    if ((paramInt & 0xC0000000) == -1073741824)
    {
      int m = 1;
      int n = -1 + NT_STATUS_CODES.length;
      int i1;
      for (;;)
      {
        if (n < m) {
          break label150;
        }
        i1 = (m + n) / 2;
        if (paramInt > NT_STATUS_CODES[i1])
        {
          m = i1 + 1;
        }
        else
        {
          if (paramInt >= NT_STATUS_CODES[i1]) {
            break;
          }
          n = i1 - 1;
        }
      }
      return NT_STATUS_MESSAGES[i1];
    }
    int i = 0;
    int j = -1 + DOS_ERROR_CODES.length;
    while (j >= i)
    {
      int k = (i + j) / 2;
      if (paramInt > DOS_ERROR_CODES[k][0]) {
        i = k + 1;
      } else if (paramInt < DOS_ERROR_CODES[k][0]) {
        j = k - 1;
      } else {
        return DOS_ERROR_MESSAGES[k];
      }
    }
    label150:
    return "0x" + Dumper.toHexString(paramInt, 8);
  }
  
  private static String getMessageByWinerrCode(int paramInt)
  {
    int i = 0;
    int j = -1 + WINERR_CODES.length;
    while (j >= i)
    {
      int k = (i + j) / 2;
      if (paramInt > WINERR_CODES[k]) {
        i = k + 1;
      } else if (paramInt < WINERR_CODES[k]) {
        j = k - 1;
      } else {
        return WINERR_MESSAGES[k];
      }
    }
    return paramInt + "";
  }
  
  static int getStatusByCode(int paramInt)
  {
    if ((0xC0000000 & paramInt) != 0) {
      return paramInt;
    }
    int i = 0;
    int j = -1 + DOS_ERROR_CODES.length;
    while (j >= i)
    {
      int k = (i + j) / 2;
      if (paramInt > DOS_ERROR_CODES[k][0]) {
        i = k + 1;
      } else if (paramInt < DOS_ERROR_CODES[k][0]) {
        j = k - 1;
      } else {
        return DOS_ERROR_CODES[k][1];
      }
    }
    return -1073741823;
  }
  
  public int getNtStatus()
  {
    return this.status;
  }
}


/* Location:           C:\Users\Admin\Desktop\Decompiler\JAD\jd-gui-0.3.6.windows\classes_dex2jar.jar
 * Qualified Name:     com.dynamixsoftware.printershare.smb.SmbException
 * JD-Core Version:    0.7.0.1
 */